using UnityEngine;
using System.Collections;

/**
 * Test script. Does stuff on key press
 */
public class TestKey : MonoBehaviour {

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
		if (Input.GetKeyDown( KeyCode.Q )) {
			print ("AND PRESSED" );	
			
			GetComponent<GenerateObjects>().spawn();
		}
		
		if (Input.GetKeyDown( KeyCode.D )) {
			GameObject player = GenerateObjects.getPlayer();
			if (player != null) {
				player.GetComponent<TestPlayerUpdate>().isRight = true;
			}
		}
		if (Input.GetKeyDown( KeyCode.S )) {
			GameObject player = GenerateObjects.getPlayer();
			if (player != null) {
				player.GetComponent<TestPlayerUpdate>().isLeft = true;
			}
		}
		if (Input.GetKeyUp( KeyCode.D )) {
			GameObject player = GenerateObjects.getPlayer();
			if (player != null) {
				player.GetComponent<TestPlayerUpdate>().isRight = false;
			}
		}
		if (Input.GetKeyUp( KeyCode.S )) {
			GameObject player = GenerateObjects.getPlayer();
			if (player != null) {
				player.GetComponent<TestPlayerUpdate>().isLeft = false;
			}
		}
	}
}
